﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using UnityEngine.EventSystems;

// 角色属性界面
public class AttributeDlg : Dialog {

    private RawImage _modelRangeImage;

    private UIModel _uiModel;
    private UIModel _uiModel2;

    public AttributeDlg()
    {
        Init("Prefabs/UI/System/AttributeDlg");
        _modelRangeImage = _root.FindComponent<RawImage>("bg/ModelRangeImage/RawImage");

        var modelPath = RoleMgr.Instance.MainRole.TableData.ModelPath;
        var model = ResMgr.Instance.GetGameObject(modelPath);
        //使用UIModel
        _uiModel = UIModelMgr.Instance.CreatOneUIModel(_modelRangeImage, model);

        var rawImage2 = _root.FindComponent<RawImage>("bg/AttrRangeImage/RawImage1");
        var model2 = ResMgr.Instance.GetGameObject(NpcTable.Instance[1].ModelPath);
        _uiModel2 = UIModelMgr.Instance.CreatOneUIModel(rawImage2, model2);
    }

    protected override void onBtnClose()
    {
        UIModelMgr.Instance.Release(_uiModel);
        UIModelMgr.Instance.Release(_uiModel2);

        base.onBtnClose();
    }
}
